/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.testapp.timemanagment.controllers;

import com.testapp.timemanagment.services.AccountService;
import javax.annotation.Resource;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
 *
 * @author dbukhanets
 */
@Controller
public class CronController extends QuartzJobBean{

    @Autowired
    SchedulerFactoryBean scheduler;

    public SchedulerFactoryBean getScheduler() {
        return scheduler;
    }

    public void setScheduler(SchedulerFactoryBean scheduler) {
        this.scheduler = scheduler;
    }
    
	@Resource(name = "accountService")
	private AccountService accountService;

    public void setAccountService(AccountService accountService) {
        this.accountService = accountService;
    }

	
	@RequestMapping("cron.htm")
	public ModelAndView indexHandler() {
		
		return null;
	}

    @Override
    protected void executeInternal(JobExecutionContext jec) throws JobExecutionException {
        accountService.logout();
    }

}
